<style>
  .ivu-table td.demo-table-info-column{
    font-size: 18px;
  }
</style>
<template>
  <div>
    <Tabs type="card" @on-click="clickTabs" :value="paneName">
      <TabPane name="1" label="单次治疗">
        <Tabs type="card" @on-click="clickTabs1" :value="paneName1">
          <TabPane name="2" label="处置项目">
            <plan-project-list ref="planProject" v-on="{addProject:addProject}"></plan-project-list>
          </TabPane>
          <TabPane name="1" label="处方产品">
            <plan-product-list ref="planProduct" v-on="{addProduct:addProduct}"></plan-product-list>
          </TabPane>
        </Tabs>
      </TabPane>
      <TabPane name="2" label="长期治疗">
        <Tabs type="card" @on-click="clickTabs2" :value="paneName2">
          <TabPane name="1" label="疗程列表">
            <plan-course-list ref="planCourseList" v-on="{addCourse:addCourse}"></plan-course-list>
          </TabPane>
          <TabPane name="2" label="长期处方产品">
            <plan-course-product-list ref="courseProductList" v-on="{addCourseProduct:addCourseProduct}"></plan-course-product-list>
          </TabPane>
        </Tabs>
      </TabPane>
      <TabPane name="3" label="家庭病房">
        <Tabs type="card" @on-click="clickTabs3" :value="paneName3">
          <TabPane name="1" label="病房列表">
            <plan-home-list ref="planHomeList" v-on="{renewal:renewal}"></plan-home-list>
          </TabPane>
          <TabPane name="2" label="创建">
            <Row :gutter="2">
              <Col :span="12">
                <Card :dis-hover="true">
                  <p slot="title">
                    请选择
                  </p>
                  <home-list ref="homeList" v-on="{selectHome:selectHome}"></home-list>
                </Card>
              </Col>
              <Col :span="12">
                <Card :dis-hover="true">
                  <p slot="title">
                    已选择
                  </p>
                  <a href="#" slot="extra" align="center">
                    <Button style="width: 100px" type="info" @click="doAddHome">提交</Button>
                  </a>
                  <Table border :columns="columns5" :data="data5"></Table>
                </Card>
              </Col>
            </Row>
            <br>
          </TabPane>
        </Tabs>
      </TabPane>
      <TabPane name="4" label="外科">
        <treat-plan-surgical-project-list ref="tpspl"></treat-plan-surgical-project-list>
      </TabPane>
    </Tabs>
    <Modal v-model="showPlan" :closable='false' :mask-closable=true :width="1000">
      <Card :bordered="false" :dis-hover="true">
        <p slot="title">
          <Icon type="monitor"></Icon>
          优惠方案
        </p>
        <Tabs @on-click="clickPlan" :value="planName">
          <TabPane name="1" label="可选方案">
            <home-product-list ref="l2" :homeId="homeId" v-on="{selectHomeProduct:selectHomeProduct}"></home-product-list>
            <home-project-list ref="l1" :homeId="homeId" v-on="{selectHomeProject:selectHomeProject}"></home-project-list>
          </TabPane>
          <TabPane name="2" label="折扣方案">
            <!--<div class="test test-1">-->
              <!--<div class="scrollbar">-->
                <!--<Card :bordered="false" :dis-hover="true">-->
                  <home-discount-product-list ref="l5" :homeId="homeId" v-on="{selectDiscountProduct:selectDiscountProduct}"></home-discount-product-list>
                  <home-discount-product-details-list ref="l6" :homeId="homeId" v-on="{selectDiscountProductDetails:selectDiscountProductDetails}"></home-discount-product-details-list>
                  <home-discount-project-list ref="l3" :homeId="homeId" v-on="{selectDiscountProject:selectDiscountProject}"></home-discount-project-list>
                  <home-discount-project-details-list ref="l4" :homeId="homeId" v-on="{selectDiscountProjectDetails:selectDiscountProjectDetails}"></home-discount-project-details-list>
                <!--</Card>-->
              <!--</div>-->
            <!--</div>-->
          </TabPane>
        </Tabs>
      </Card>
      <Card :bordered="false" :dis-hover="true">
        <p slot="title">
          <Icon type="compose"></Icon>
          已选方案
        </p>
        <Table v-if="this.data6.length > 0" border :showHeader="false" :columns="columns6" :data="data6"></Table>
        <Table v-if="this.data7.length > 0" border :showHeader="false" :columns="columns7" :data="data7" style="margin-top: 5px"></Table>
        <Table v-if="this.data8.length > 0" border :showHeader="false" :columns="columns8" :data="data8" style="margin-top: 5px"></Table>
        <Table v-if="this.data9.length > 0" border :showHeader="false" :columns="columns9" :data="data9" style="margin-top: 5px"></Table>
        <Table v-if="this.data10.length > 0" border :showHeader="false" :columns="columns10" :data="data10" style="margin-top: 5px"></Table>
        <Table v-if="this.data11.length > 0" border :showHeader="false" :columns="columns11" :data="data11" style="margin-top: 5px"></Table>
      </Card>
      <div slot="footer">
        <Button type="text" @click="addHome">跳过</Button>
        <Button type="primary" @click="addHome">确定</Button>
      </div>
    </Modal>
    <Modal v-model="showEdit" @on-ok="editHome" ok-text="保存" cancel-text="取消" :closable='false' :mask-closable=true :width="1000">
      <Card :bordered="false" :dis-hover="true">
        <p slot="title">
          基本方案
        </p>
        <Card v-if="this.data12.length > 0" :bordered="false" :dis-hover="true">
          <p slot="title">
            处置笺
          </p>
          <Table border :columns="columns12" :data="data12"></Table>
        </Card>
        <Card v-if="this.data13.length > 0" :bordered="false" :dis-hover="true">
          <p slot="title">
            处方笺
          </p>
          <Table border :columns="columns13" :data="data13"></Table>
        </Card>
      </Card>
      <Card :bordered="false" :dis-hover="true">
        <p slot="title">
          优惠方案
        </p>
        <Card :bordered="false" :dis-hover="true">
          <Table v-if="this.data14.length > 0" border :show-header="false" :columns="columns14" :data="data14"></Table>
          <Table style="margin-top: 5px" v-if="this.data15.length > 0" border :show-header="false" :columns="columns15" :data="data15"></Table>
          <Table style="margin-top: 5px" v-if="this.data16.length > 0" border :show-header="false" :columns="columns16" :data="data16"></Table>
          <label v-if="this.data14.length === 0 && this.data15.length === 0 && this.data16.length === 0"><Tag type="dot" color="yellow">你没有选择任何优惠</Tag></label>
        </Card>
      </Card>
    </Modal>
    <Modal v-model="showModal1" ok-text="保存" cancel-text="取消" :closable='false' :mask-closable=true :width="1000">
      <h3 slot="header" style="color:#2D8CF0">选择处置项目</h3>
      <Tabs type="card">
        <TabPane label="请选择">
          <project-list ref="projectList" v-on="{selectProject:selectProject}"></project-list>
        </TabPane>
        <TabPane :label="label1">
          <Table border :columns="columns2" :data="data2"></Table>
        </TabPane>
        <Button type="primary" @click="doAddProject" style="height: 30px" slot="extra">保存</Button>
      </Tabs>
      <div slot="footer">
      </div>
    </Modal>
    <Modal v-model="showModal2" ok-text="保存" cancel-text="取消" :closable='false' :mask-closable=true :width="1000">
      <h3 slot="header" style="color:#2D8CF0">选择处方产品</h3>
      <Tabs type="card">
        <TabPane label="请选择">
          <product-list ref="productList" v-on="{selectProduct:selectProduct}"></product-list>
        </TabPane>
        <TabPane :label="label2">
          <Table border :columns="columns1" :data="data1"></Table>
        </TabPane>
        <Button type="primary" @click="doAddProduct" style="height: 30px" slot="extra">保存</Button>
      </Tabs>
      <div slot="footer">
      </div>
    </Modal>
    <Modal v-model="showModal3" ok-text="保存" cancel-text="取消" :closable='false' :mask-closable=true :width="1000">
      <h3 slot="header" style="color:#2D8CF0">选择疗程</h3>
      <Tabs type="card">
        <TabPane label="请选择">
          <course-list ref="courseList" v-on="{selectCourse:selectCourse}"></course-list>
        </TabPane>
        <TabPane :label="label3">
          <Table border :columns="columns3" :data="data3"></Table>
        </TabPane>
        <Button type="primary" @click="doAddCourse" style="height: 30px" slot="extra">保存</Button>
      </Tabs>
      <div slot="footer">
      </div>
    </Modal>
    <Modal v-model="showModal4" ok-text="保存" cancel-text="取消" :closable='false' :mask-closable=true :width="1000">
      <h3 slot="header" style="color:#2D8CF0">选择长期处方产品</h3>
      <Tabs type="card">
        <TabPane label="请选择">
          <product-list ref="courseProduct" v-on="{selectProduct:selectProduct}"></product-list>
        </TabPane>
        <TabPane :label="label4">
          <Table border :columns="columns4" :data="data4"></Table>
        </TabPane>
        <Button type="primary" @click="doAddCourseProduct" style="height: 30px" slot="extra">保存</Button>
      </Tabs>
      <div slot="footer">
      </div>
    </Modal>
  </div>
</template>
<script>
    import productList from '@/view/business/medical/list/ProductList.vue';
    import projectList from '@/view/business/medical/list/ProjectList.vue';
    import planProductList from '@/view/business/medical/list/TreatPlanProductList.vue';
    import planProjectList from '@/view/business/medical/list/TreatPlanProjectList.vue';
    import courseList from '@/view/business/medical/list/CourseList.vue';
    import planCourseList from '@/view/business/medical/list/TreatPlanCourseList.vue';
    import planCourseProductList from '@/view/business/medical/list/TreatPlanCourseProductList.vue';
    import planHomeList from '@/view/business/medical/list/TreatPlanHomeList.vue';
    import homeList from '@/view/business/medical/list/HomeList.vue';
    import homeProjectList from '@/view/business/medical/list/HomeProjectList.vue';
    import homeProductList from '@/view/business/medical/list/HomeProductList.vue';
    import homeDiscountProjectList  from '@/view/business/medical/list/HomeDiscountProjectList.vue';
    import homeDiscountProjectDetailsList  from '@/view/business/medical/list/HomeDiscountProjectDetailsList.vue';
    import homeDiscountProductList  from '@/view/business/medical/list/HomeDiscountProductList.vue';
    import homeDiscountProductDetailsList  from '@/view/business/medical/list/HomeDiscountProductDetailsList.vue';
    import treatPlanSurgicalProjectList from '@/view/business/medical/list/TreatPlanSurgicalProjectList.vue';
    export default {
        components: {
            productList,
            projectList,
            planProductList,
            planProjectList,
            courseList,
            planCourseList,
            planCourseProductList,
            planHomeList,
            homeList,
            homeProjectList,
            homeProductList,
            homeDiscountProjectList,
            homeDiscountProjectDetailsList,
            homeDiscountProductList,
            homeDiscountProductDetailsList,
            treatPlanSurgicalProjectList
        },
        data () {
            return {
                showModal1: false,
                label1: (h) => {
                    return h('div', [
                        h('span', '已选择'),
                        h('Badge', {
                            props: {
                                count: this.data2.length
                            }
                        })
                    ])
                },
                showModal2: false,
                label2: (h) => {
                    return h('div', [
                        h('span', '已选择'),
                        h('Badge', {
                            props: {
                                count: this.data1.length
                            }
                        })
                    ])
                },
                showModal3: false,
                label3: (h) => {
                    return h('div', [
                        h('span', '已选择'),
                        h('Badge', {
                            props: {
                                count: this.data3.length
                            }
                        })
                    ])
                },
                showModal4: false,
                label4: (h) => {
                    return h('div', [
                        h('span', '已选择'),
                        h('Badge', {
                            props: {
                                count: this.data4.length
                            }
                        })
                    ])
                },
                homeId: -1,
                homeProjectURL: '/user/home/project',
                homeProductURL: '/user/home/product',
                productURL: '/user/treat/plan/product',
                projectURL: '/user/treat/plan/project',
                courseURL: '/user/treat/plan/course',
                courseProductURL: '/user/treat/plan/course/product',
                homeURL: '/user/home',
                planHomeURL: '/user/treat/plan/home',
                planName: '1',
                selectRows: [],
                selectPojo: {},
                treatPlanHome: {},
                homeIndex: '',
                showPlan: false,
                showEdit: false,
                paneName: '1',
                paneName1: '2',
                paneName2: '1',
                paneName3: '1',
                setting: {
                    radiusDot: true,
                    arrow: 'always'
                },
                data1: [],
                columns1: [
                    {
                        title: '产品名称',
                        key: 'name',
                    },
                    {
                        title: '购买数量',
                        key: 'quantity',
                        width: 150,
                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.quantity
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.quantity = value
                                        vm.data1[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data2: [],
                columns2: [
                    {
                        title: '项目名称',
                        key: 'name',

                    },
                    {
                        title: '购买次数',
                        key: 'quantity',
                        width: 150,
                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.quantity
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.quantity = value
                                        vm.data2[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 250,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data3: [],
                columns3: [
                    {
                        title: '疗程名称',
                        key: 'name',
                    },
                    {
                        title: '购买数量',
                        key: 'quantity',
                        width: 150,
                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.quantity
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.quantity = value
                                        vm.data3[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data4: [],
                columns4: [
                    {
                        title: '产品名称',
                        key: 'name',
                    },
                    {
                        title: '购买数量',
                        key: 'quantity',
                        width: 150,
                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.quantity
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.quantity = value
                                        vm.data4[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data5: [],
                columns5: [
                    {
                        title: '病房名称',
                        key: 'homeName',
                        width: 300
                    },
                    {
                        title: '购买数量',
                        key: 'quantity',
                    },
                    {
                        title: '价格',
                        key: 'totalPrice',
                        render: (h, params) => {
                            let temp = params.row.totalPrice
                            if (params.row.discount !== 1) {
                                temp += '（' + params.row.discount + '折）'
                            }
                            return h('span', temp)
                        }
                    },
                    {
                        title: '操作',
                        width: 200,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'primary',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.edit(params.index, params.row)
                                        }
                                    }
                                }, '编辑'),
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data6: [],
                columns6: [
                    {
                        title: '项目名称',
                        key: 'projectName',
                    },
                    {
                        title: '次数',
                        key: 'quantity',
                        width: 150,
                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.quantity
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.quantity = value
                                        vm.data6[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data7: [],
                columns7: [
                    {
                        title: '产品名称',
                        key: 'productName',
                    },
                    {
                        title: '数量',
                        key: 'quantity',
                        width: 150,
                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.quantity
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.quantity = value
                                        vm.data7[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data8: [],
                columns8: [
                    {
                        title: '项目类型',
                        key: 'projectTypeName',
                    },
                    {
                        title: '折扣',
                        key: 'discount',
                        width: 150,
                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.discount
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.discount = value
                                        vm.data8[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data9: [],
                columns9: [
                    {
                        title: '项目名称',
                        key: 'projectName',

                    },
                    {
                        title: '折扣',
                        key: 'discount',
                        width: 150,

                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.discount
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.discount = value
                                        vm.data9[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data10: [],
                columns10: [
                    {
                        title: '产品类别',
                        key: 'categoryName',

                    },
                    {
                        title: '折扣',
                        key: 'discount',
                        width: 150,

                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.discount
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.discount = value
                                        vm.data10[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data11: [],
                columns11: [
                    {
                        title: '产品名称',
                        key: 'productName',

                    },
                    {
                        title: '折扣',
                        key: 'discount',
                        width: 150,

                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.discount
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.discount = value
                                        vm.data11[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data12: [],
                columns12: [
                    {
                        title: '项目名称',
                        key: 'projectName',

                    },
                    {
                        title: '次数',
                        key: 'quantity',
                        width: 150,

                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.quantity
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.quantity = value
                                        vm.data12[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            params.row.dataType = 12
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data13: [],
                columns13: [
                    {
                        title: '产品名称',
                        key: 'productName',

                    },
                    {
                        title: '数量',
                        key: 'quantity',
                        width: 150,

                        render: (h, params) => {
                            var vm = this
                            return h('InputNumber',{
                                props: {
                                    min: 1,
                                    value: params.row.quantity
                                },
                                style: {
                                    width: '100%'
                                },
                                on: {
                                    'on-change' (value) {
                                        params.row.quantity = value
                                        vm.data12[params.index] = params.row
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '操作',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'default'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            params.row.dataType = 13
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data14: [],
                columns14: [
                    {
                        title: '项目名称',
                        key: 'name',

                    },
                    {
                        title: '次数',
                        key: 'quantity',
                        width: 150,

                        render: (h, params) => {
                            return params.row.quantity + '次'
                        }
                    }
                ],
                data15: [],
                columns15: [
                    {
                        title: '产品名称',
                        key: 'name',

                    },
                    {
                        title: '数量',
                        key: 'quantity',
                        width: 150,

                        render: (h, params) => {
                            return params.row.quantity + '件'
                        }
                    }
                ],
                data16: [],
                columns16: [
                    {
                        title: '折扣名称',
                        key: 'name',
                    },
                    {
                        title: '折扣',
                        key: 'discount',
                        width: 150,
                        render: (h, params) => {
                            return params.row.discount + '折'
                        }
                    }
                ]
            }
        },
        methods: {
            clickTabs (name) {
                if (name === '1') {
                    this.clickTabs1('2')
                } else if (name === '2') {
                    this.paneName2 = '1'
                    this.$refs.planCourseList.refresh()
                } else if (name === '3') {
                    this.paneName3 = '1'
                    this.$refs.planHomeList.refresh()
                } else if (name === '4') {
                    this.$refs.tpspl.refresh()
                }
                this.paneName = name
            },
            clickPlan (name) {
                this.planName = name
            },
            clickTabs1 (name) {
                if (name === '1') {
                    this.refreshProductList()
                } else if (name === '2') {
                    this.refreshProjectList()
                } else if (name === '3') {
                    this.refresh1()
                    this.data1 = []
                    this.data2 = []
                }
                this.paneName1 = name
            },
            clickTabs2 (name) {
                if (name === '1') {
                    this.$refs.planCourseList.refresh()
                } else if (name === '2') {
                    this.$refs.courseProductList.refresh()
                } else if (name === '3') {
                    this.refresh2()
                    this.data3 = []
                }
                this.paneName2 = name
            },
            clickTabs3 (name) {
                this.$refs.homeList.display1 = 'none'
                this.$refs.homeList.display2 = ''
                if (name === '1') {
                    this.$refs.planHomeList.refresh()
                } else if (name === '2') {
                    this.$refs.homeList.refresh()
                }
                this.paneName3 = name
            },
            refresh1 () {
                this.$refs.productList.refresh()
                this.$refs.projectList.refresh()
            },
            refresh2 () {
                this.$refs.courseList.refresh()
                this.$refs.courseProduct.refresh()
            },
            refreshProductList () {
                this.$refs.planProduct.refresh()
            },
            refreshProjectList () {
                this.$refs.planProject.refresh()
            },
            clear () {
                this.data6 = []
                this.data7 = []
                this.data8 = []
                this.data9 = []
                this.data10 = []
                this.data11 = []
            },
            addProject () {
                this.data2 = []
                this.$refs.projectList.refresh()
                this.showModal1 = true
            },
            addProduct () {
                this.data1 = []
                this.$refs.productList.refresh()
                this.showModal2 = true
            },
            addCourse () {
                this.data3 = []
                this.$refs.courseList.refresh()
                this.showModal3 = true
            },
            addCourseProduct () {
                this.data4 = []
                this.$refs.courseProduct.refresh()
                this.showModal4 = true
            },
            addHome () {
                let treatPlanHome = {}
                treatPlanHome.complaintId = this.$store.state.app.complaintId
                treatPlanHome.homeId = this.treatPlanHome.id
                treatPlanHome.homeName = this.treatPlanHome.name
                treatPlanHome.treatCycle = this.treatPlanHome.duration
                treatPlanHome.price = this.treatPlanHome.price
                treatPlanHome.quantity = 1
                treatPlanHome.discount = this.treatPlanHome.discount
                treatPlanHome.totalPrice = this.treatPlanHome.price * this.treatPlanHome.discount
                treatPlanHome.isRenewal = this.treatPlanHome.isRenewal
                if (this.data6.length > 0) {
                    let projects = []
                    projects[1] = this.data6
                    treatPlanHome.projects = projects
                }
                if (this.data7.length > 0) {
                    let products = []
                    products[1] = this.data7
                    treatPlanHome.products = products
                }
                if (this.data8.length > 0) {
                    treatPlanHome.discountProjects = this.data8
                }
                if (this.data9.length > 0) {
                    treatPlanHome.discountProjectDetails = this.data9
                }
                if (this.data10.length > 0) {
                    treatPlanHome.discountProducts = this.data10
                }
                if (this.data11.length > 0) {
                    treatPlanHome.discountProductDetails = this.data11
                }
                this.data5.push(treatPlanHome)
                this.showPlan = false
            },
            edit (index, row) {
                this.homeIndex = index
                this.treatPlanHome = row
                let url = this.homeProjectURL + '/findBasic/' + row.homeId
                this.$ajax.get(url).then((response) => {
                    let {code, data, msg} = response.data
                    if (code === 0) {
                        this.data12 = data
                    } else {
                        this.$bus.alert('error', msg)
                    }
                })
                url = this.homeProductURL + '/findBasic/' + row.homeId
                this.$ajax.get(url).then((response) => {
                    let {code, data, msg} = response.data
                    if (code === 0) {
                        this.data13 = data
                    } else {
                        this.$bus.alert('error', msg)
                    }
                })
                this.data14 = []
                if (row.hasOwnProperty('projects') && row.projects[1].length > 0) {
                    for (let item of row.projects[1]) {
                        let temp = {}
                        temp.name = item.projectName
                        temp.quantity = item.quantity
                        this.data14.push(temp)
                    }
                }
                this.data15 = []
                if (row.hasOwnProperty('products') && row.products[1].length > 0) {
                    for (let item of row.products[1]) {
                        let temp = {}
                        temp.name = item.productName
                        temp.quantity = item.quantity
                        this.data15.push(temp)
                    }
                }
                this.data16 = []
                if (row.hasOwnProperty('discountProjects') && row.discountProjects.length > 0) {
                    for (let item of row.discountProjects) {
                        let temp = {}
                        temp.name = item.projectTypeName
                        temp.discount = item.discount
                        this.data16.push(temp)
                    }
                }
                if (row.hasOwnProperty('discountProjectDetails') && row.discountProjectDetails.length > 0) {
                    for (let item of row.discountProjectDetails) {
                        let temp = {}
                        temp.name = item.projectName
                        temp.discount = item.discount
                        this.data16.push(temp)
                    }
                }
                if (row.hasOwnProperty('discountProducts') && row.discountProducts.length > 0) {
                    for (let item of row.discountProducts) {
                        let temp = {}
                        temp.name = item.categoryName
                        temp.discount = item.discount
                        this.data16.push(temp)
                    }
                }
                if (row.hasOwnProperty('discountProductDetails') && row.discountProductDetails.length > 0) {
                    for (let item of row.discountProductDetails) {
                        let temp = {}
                        temp.name = item.productName
                        temp.discount = item.discount
                        this.data16.push(temp)
                    }
                }
                setTimeout(() => {
                    this.showEdit = true
                }, 100)
            },
            editHome () {
                if (this.data12.length > 0) {
                    if (this.treatPlanHome.hasOwnProperty('projects')) {
                        this.treatPlanHome.projects[0] = this.data12
                    } else {
                        let projects = []
                        projects[0] = this.data12
                        this.treatPlanHome.projects = projects
                    }
                }
                if (this.data13.length > 0) {
                    if (this.treatPlanHome.hasOwnProperty('products')) {
                        this.treatPlanHome.products[0] = this.data13
                    } else {
                        let products = []
                        products[0] = this.data13
                        this.treatPlanHome.products = products
                    }
                }
                this.data5[this.homeIndex] = this.treatPlanHome
                this.$bus.alert('success', '操作成功')
            },
            doAddProject () {
                if (this.data2.length > 0) {
                    let url = this.projectURL + '/saveOrUpdate/' + this.$store.state.app.patientId
                    this.$ajax.post(url, this.data2).then((response) => {
                        let {code, msg} = response.data
                        if (code === 0) {
                            this.$bus.alert('success', '已保存')
                            this.showModal1 = false
                            this.$refs.planProject.refresh()
                        } else {
                            this.$bus.alert('error', msg)
                        }
                    })
                } else {
                    this.$bus.alert('warning', '你没有选择任何处置项目')
                }
            },
            doAddProduct () {
                if (this.data1.length > 0) {
                    let url = this.productURL + '/saveOrUpdate/' + this.$store.state.app.patientId
                    this.$ajax.post(url, this.data1).then((response) => {
                        let {code, msg} = response.data
                        if (code === 0) {
                            this.$bus.alert('success', '已保存')
                            this.showModal2 = false
                            this.$refs.planProduct.refresh()
                        } else {
                            this.$bus.alert('error', msg)
                        }
                    })
                } else {
                    this.$bus.alert('warning', '你没有选择任何处方产品')
                }
            },
            doAddCourse () {
                if (this.data3.length > 0) {
                    let url = this.courseURL + '/saveOrUpdate/' + this.$store.state.app.patientId
                    this.$ajax.post(url, this.data3).then((response) => {
                        let {code, msg} = response.data
                        if (code === 0) {
                            this.$bus.alert('success', '已保存')
                            this.showModal3 = false
                            this.$refs.planCourseList.refresh()
                        } else {
                            this.$bus.alert('error', msg)
                        }
                    })
                } else {
                    this.$bus.alert('warning', '你没有选择任何疗程')
                }
            },
            doAddCourseProduct () {
                if (this.data4.length > 0) {
                    let url = this.courseProductURL + '/saveOrUpdate/' + this.$store.state.app.patientId
                    this.$ajax.post(url, this.data4).then((response) => {
                        let {code, msg} = response.data
                        if (code === 0) {
                            this.$bus.alert('success', '已保存')
                            this.showModal4 = false
                            this.$refs.courseProductList.refresh()
                        } else {
                            this.$bus.alert('error', msg)
                        }
                    })
                } else {
                    this.$bus.alert('warning', '你没有选择任何长期处方产品')
                }
            },
            doAddHome () {
                if (this.data5.length > 0) {
                    let url = this.planHomeURL + '/saveOrUpdate/' + this.$store.state.app.patientId
                    this.$ajax.post(url, this.data5).then((response) => {
                        let {code, msg} = response.data
                        if (code === 0) {
                            this.$bus.alert('success', '已保存')
                            this.data5 = []
                        } else {
                            this.$bus.alert('error', msg)
                        }
                    })
                } else {
                    this.$bus.alert('warning', '你没有选择任何病房')
                }
            },
            selectProduct (row) {
                // 标识添加的数据是产品
                row.complaintId = this.$store.state.app.complaintId
                row.productId = row.id
                row.productName = row.name
                row.price = row.price
                row.quantity = 1
                if (this.paneName === '1') {
                    row.type = 1
                    this.data1.push(row)
                } else if (this.paneName === '2') {
                    row.type = 4
                    this.data4.push(row)
                }
            },
            selectProject (row) {
                // 表示项目数据
                row.type = 2
                row.complaintId = this.$store.state.app.complaintId
                row.projectId = row.id
                row.projectName = row.name
                row.price = row.price
                row.quantity = 1
                this.data2.push(row)
            },
            selectCourse (row) {
                row.complaintId = this.$store.state.app.complaintId
                row.courseId = row.id
                row.courseName = row.name
                row.price = row.price
                row.quantity = 1
                row.type = 3
                this.data3.push(row)
            },
            selectHome (row) {
                this.clear()
                this.homeId = row.id
                this.treatPlanHome = row
                this.planName = '1'
                this.showPlan = true
                this.refreshDetails()
            },
            renewal () {
                this.$refs.homeList.display1 = ''
                this.$refs.homeList.display2 = 'none'
                this.paneName3 = '2'
            },
            selectHomeProject (row) {
                row.dataType = 6
                this.data6.push(row)
            },
            selectHomeProduct (row) {
                row.dataType = 7
                this.data7.push(row)
            },
            selectDiscountProject (row) {
                row.dataType = 8
                this.data8.push(row)
            },
            selectDiscountProjectDetails (row) {
                row.dataType = 9
                this.data9.push(row)
            },
            selectDiscountProduct (row) {
                row.dataType = 10
                this.data10.push(row)
            },
            selectDiscountProductDetails (row) {
                row.dataType = 11
                this.data11.push(row)
            },
            remove (index, row) {
                if (this.paneName === '1') {
                    if (row.type === 1) {
                        this.data1.splice(index, 1);
                    } else if (row.type === 2) {
                        this.data2.splice(index, 1);
                    }
                } else if (this.paneName === '2') {
                    if (row.type === 3) {
                        this.data3.splice(index, 1);
                    } else if (row.type === 4) {
                        this.data4.splice(index, 1);
                    }
                } else if (this.paneName === '3') {
                    if (this.showPlan) {
                        if (row.dataType === 6) {
                            this.data6.splice(index, 1);
                        } else if (row.dataType === 7) {
                            this.data7.splice(index, 1);
                        } else if (row.dataType === 8) {
                            this.data8.splice(index, 1);
                        } else if (row.dataType === 9) {
                            this.data9.splice(index, 1);
                        } else if (row.dataType === 10) {
                            this.data10.splice(index, 1);
                        } else if (row.dataType === 11) {
                            this.data11.splice(index, 1);
                        }
                    } else if (this.showEdit) {
                        if (row.dataType === 12) {
                            this.data12.splice(index, 1);
                        } else if (row.dataType === 13) {
                            this.data13.splice(index, 1);
                        }
                    } else {
                        this.data5.splice(index, 1);
                    }
                }
            },
            changeSelect (rows) {
                this.selectRows = rows
            },
            changeTotalSize (totalSize) {
                this.pageModel.totalSize = totalSize
            },
            refreshDetails () {
                this.$refs.l1.refresh()
                this.$refs.l2.refresh()
                this.$refs.l3.refresh()
                this.$refs.l4.refresh()
                this.$refs.l5.refresh()
                this.$refs.l6.refresh()
            }
        }
    }
</script>
<style>
  label{
    font-size: 20px;
  }
  Card {
    height: 300px;
  }
  .test{
    height: 100%;
    overflow: auto;
    float: left;
    margin-right: 10px;
    border: none;
  }
  .scrollbar{
    height: 100%;
    margin: 0 auto;
  }
  .test-1::-webkit-scrollbar {/*滚动条整体样式*/
    width: 10px;     /*高宽分别对应横竖滚动条的尺寸*/
    height: 1px;
  }
  .test-1::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
    background: #fdece8;
  }
  .test-1::-webkit-scrollbar-track {/*滚动条里面轨道*/
    -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
    border-radius: 10px;
    /*background: #ffebcc;*/
  }
</style>